package com.kotlin.main;

import java.util.HashMap;
import java.util.Map;

import com.kotlin.base.http.YHttp;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;

/**
 * 类 名: Demo
 * 作 者: yzhg
 * 创 建: 2018/11/16 0016
 * 版 本: 1.0
 * 历 史: (版本) 作者 时间 注释
 * 描 述:
 */
public class Demo {
    public void getCelebratedDictum() {

        Map<String, String> map = new HashMap<>();
        YHttp.Companion.getInstance().requestPostRx("123", map)
                .subscribeOn(Schedulers.io()) //绑定IO线程
                .map(new Function<ResponseBody, Object>() {
                    @Override
                    public Object apply(ResponseBody responseBody) throws Exception {
                        return null;
                    }
                })
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<Object>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(Object o) {

                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }

}
